import Toast from '@vant/weapp/dist/toast/toast';
import { getToken } from '@/utils/auth'


export function toPage(item) {
    // 先判断是否登录
    let token = getToken()
    if (!token) {
        return Toast.fail({
            message: '请先登录',
            duration: 1000,
            forbidClick: true,
            onClose: () => {
                uni.navigateTo({
                    url: `/pages/wxlogin/index`
                })
            }
        })

    }
    // createPreKey - modelTypeId
    switch (+item.modelTypeId) {
        case 1:// 文生图
            uni.navigateTo({
                url: `/draw/textGeneratePic/index?item=${JSON.stringify(item)}`
            })
            break;

        case 2:// 智能抠图
            uni.navigateTo({
                url: `/draw/imgMatting/index?item=${JSON.stringify(item)}`
            })
            break;

        case 3:// 变高清
            uni.navigateTo({
                url: `/draw/highQualityPic/index?item=${JSON.stringify(item)}`
            })
            break;

        case 4:// ai消除
            uni.navigateTo({
                url: `/newEditionDraw/eliminate/index?item=${JSON.stringify(item)}`
            })
            break;

        case 5:// 图生图
            uni.navigateTo({
                url: `/draw/pictureGenneratePic/index?item=${JSON.stringify(item)}`
            })
            break;

        case 6:// 生成背景
            uni.navigateTo({
                url: `/draw/orgGenerationBgc/index?item=${JSON.stringify(item)}`
            })
            break;

        case 7:// 高级生成背景
            uni.navigateTo({
                url: `/draw/generationBgImgSize/index?item=${JSON.stringify(item)}`
            })
            break;

        case 8:// 扩图
            uni.navigateTo({
                url: `/draw/expansionPicture/index?item=${JSON.stringify(item)}`
            })
            break;
        case 9:// 局部绘图
            uni.navigateTo({
                url: `/newEditionDraw/localRedrawing/index?item=${JSON.stringify(item)}`
            })
            break;
        case 10:// 背景生成（商品生成）
            uni.navigateTo({
                url: `/draw/vipOrgGenerationBgc/index?item=${JSON.stringify(item)}`
            })
            break;
        case 11:// 指令绘图
            uni.navigateTo({
                url: `/draw/instructDraw/index?item=${JSON.stringify(item)}`
            })
            break;
        case 12: // 背景重绘(背景构成)
            uni.navigateTo({
                url: `/newEditionDraw/bgRedrawing/index?item=${JSON.stringify(item)}`
            })
            break;
        case 13: // 图生文(背景文案)
            uni.navigateTo({
                url: `/newEditionDraw/imgCreateText/index?item=${JSON.stringify(item)}`
            })
            break;

        // case 15:// 账号分析
        // break;



        // case 17:// AI换衣
        //     break;

        // case 18:// 对口型
        //     break;

        case 20:// 重绘发型
            uni.navigateTo({
                url: `/newEditionDraw/redrawHairstyle/index?item=${JSON.stringify(item)}`
            })
            break;
        case 21:// 年龄变化
            uni.navigateTo({
                url: `/newEditionDraw/ageChange/index?item=${JSON.stringify(item)}`
            })
            break;
        case 22:// 重绘表情
            uni.navigateTo({
                url: `/newEditionDraw/redrawFace/index?item=${JSON.stringify(item)}`
            })
            break;
        case 23:// 老照片修复
            uni.navigateTo({
                url: `/newEditionDraw/oldPhotoRestoration/index?item=${JSON.stringify(item)}`
            })
            break;
        case 24:// 一键变美
            uni.navigateTo({
                url: `/newEditionDraw/beautify/index?item=${JSON.stringify(item)}`
            })
            break;

        // case 25:// 舞动人像
        //     uni.navigateTo({
        //         url: `/newEditionDraw/dancePerson/index?item=${JSON.stringify(item)}`
        //     })
        //     break;

        case 27:// 鑫鑫爱学
            uni.navigateTo({
                url: `/newEditionDraw/takePhotosAnswer/index?item=${JSON.stringify(item)}`
            })

            break;

        case 29:// AI视频
            uni.navigateTo({
                url: `/newEditionDraw/aiVideo/index?item=${JSON.stringify(item)}`
            })
            break;

        case 30: // 人物侧脸背景
            uni.navigateTo({
                url: `/draw/faceBackground/index?item=${JSON.stringify(item)}`
            })
            break;
        default:
            Toast.fail('功能即将开放')
            break;
    }
}